package com.cuitrip.business.home.travel.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.lab.adapter.IAdapterData;

import java.io.Serializable;
import java.util.ArrayList;

/**
 * 过滤的目的地item
 * Created by ak on 16/1/14.
 */
public class Destination implements IAdapterData, PopupFilterCategory<Destination.Value>, Serializable {


    public String desc;
    public String searchKey;
    public ArrayList<Value> values;

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    @Override
    public String getCategoryTitle() {
        return desc;
    }

    @Override
    public String getSearchKey() {
        return searchKey;
    }

    public void setSearchKey(String searchKey) {
        this.searchKey = searchKey;
    }

    @Override
    public ArrayList<Value> getList() {
        return values;
    }

    public ArrayList<Value> getValues() {
        return values;
    }

    public void setValues(ArrayList<Value> values) {
        this.values = values;
    }

    public class Value implements PopupFilterItem, Serializable {
        @JSONField(name = "name")
        private String name;
        @JSONField(name = "abbr")
        private String abbr;
        private boolean isSelected;


        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getAbbr() {
            return abbr;
        }

        public void setAbbr(String abbr) {
            this.abbr = abbr;
        }

        @Override
        public String getKey() {
            return name;
        }

        @Override
        public String getValue() {
            return abbr;
        }

        @Override
        public boolean isSelected() {
            return isSelected;
        }

        @Override
        public void setSelected(boolean selected) {
            isSelected = selected;
        }

        @Override
        public boolean equals(Object o) {
            if (o == null) {
                return false;
            }
            if (this == o) {
                return true;
            }
            if (o instanceof Value) {
                Value n = (Value) o;
                return this.abbr.equals(n.abbr);
            }
            return false;
        }

        public boolean isShow() {
            return true;
        }
    }
}
